<template>
	<div class="divBox">
		<el-row :gutter="20">
			<el-col :span="4" :xs="24" class="set-live-tabs">
				<template v-for="(item,index) in tabs">
					<span :key="index" class="set-live-tab" :class="active == index ? 'set-live-tab-active' : ''"
						@click="changeTab(index)">{{item.label}}</span>
				</template>
			</el-col>
			<addLive v-if="active == 0" ref="addLive"></addLive>
			<setLiveForm v-else-if="active == 2" ref="setLiveForm"></setLiveForm>
		</el-row>
	</div>
</template>

<script>
	import addLive from './addLive';
	import setLiveForm from './setLiveForm';
	export default {
		data() {
			return {
				tabs: [{
						label: '新建直播'
					},
					{
						label: '直播管理'
					},
					{
						label: '通用配置'
					},
					{
						label: '软件下载'
					}
				],
				active: 0,
			}
		},
		components: {
			addLive,
			setLiveForm
		},
		methods: {
			// 切换tab
			changeTab(index) {
				this.active = index;
			},
			// 保存
			submitForm() {

			},
			// 取消
			resetForm(formName) {
				this.$refs[formName].resetFields();
				this.$emit('resetForm');
				this.$route(-1)
			},
		}
	}
</script>

<style scoped lang="scss">
	.cursor-btn {
		color: #3e8fff;
		cursor: pointer;
	}

	.set-live-tabs {
		display: flex;
		flex-direction: column;
		text-align: center;
		background-color: #fff;
		position: fixed;
		width: 14%;
		height: 100%;
		padding: 10px;
	}

	.set-live-content {
		float: right;
	}

	.set-live-tab {
		font-size: 16px;
		padding: 10px 0;
		cursor: pointer;
	}

	.set-live-tab-active {
		background-color: #3e8fff;
		color: #fff;
		opacity: 0.9;
	}

	.set-live-tab:hover {
		background-color: #3e8fff;
		opacity: 0.5;
		color: #fff;
	}
</style>